<template>
    <div class="father">
      <h1>Father组件</h1>
      <h2>Father给Child传函数，child调用函数，Father才能拿到数据</h2>
      <h1>Father的车:{{ car }}</h1>
      <h1 v-if="toy">Child给的玩具:{{ toy }}</h1>
      <Child :fatherCar="car" :toyFunction="getToy"></Child>
    </div>
  </template>
  
  <script lang="ts" setup>
  import Child from './Child.vue'
  import useFatherComponent from '@/hooks/useFatherComponent';
  const { car, getToy,toy } = useFatherComponent()

  </script>
  
  <style scoped>
  
  </style>